<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        /**
         * disconnect()停止MutattionServer构造函数的回调函数
        */

        const observer = new MutationObserver(() => {
            console.log('<body> attributes changed')
        })

        observer.observe(document.body, {attributes: true})

        observer.disconnect() // 执行disconnect函数

        document.body.setAttribute('className', 'bodyName')  // 没有打印输出

    </script>
</body>
</html>